﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CaifenWeb.UtilityCls
{
    public class BgAuthorizeAttribute : AuthorizeAttribute
    {
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            //if (!filterContext.HttpContext.User.Identity.IsAuthenticated)
            //{
            //    filterContext.HttpContext.Response.Redirect(string.Format("~/bgmgr/webadmin/login?returnUrl={0}", filterContext.HttpContext.Request.Url.PathAndQuery));
            //}
            if (filterContext.HttpContext.Session["bgadmin"] == null)
            {
                filterContext.HttpContext.Response.Redirect(string.Format("~/bgmgr/webadmin/login?returnUrl={0}", filterContext.HttpContext.Request.Url.PathAndQuery));
            }
        }
    }
}